var express = require('express');
var router = express.Router();
const user = require('../controllers/user');

/* GET users listing. */
router.get('/', function (req, res, next) {
  res.render('login', {
    state: false
  })
});
router.get('/login', function (req, res, next) {
  res.render('login', {
    state: false
  })
});
router.get('/register', function (req, res, next) {
  res.render('register', {
    state: false
  })
});

// post
router.post('/login', user.login)
router.post('/register', user.register)

router.get('/details', function (req, res, next){
  res.render('user_details',{
    login: req.session.login,
    username: req.session.username
  })
});

module.exports = router;